import Vue from 'vue'
import './plugins/axios'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import md5 from 'js-md5'
import FileSaver from 'file-saver';
import XLSX from 'xlsx';

// import $$layer from "layui-layer"

import $ from 'jquery'

import axios from 'axios'
// Vue.prototype.$axios = axios
Vue.prototype.$http = axios

Vue.prototype.$md5 = md5;
// 配置请求根路径
axios.defaults.baseURL = '/api'
// axios.defaults.baseURL = 'http://localhost:8282'

// 通过axios请求拦截器添加token，保证拥有获取数据的权限
// axios.defaults.timeout = 5000
// axios.defaults.headers['Content-Type'] = 'application/json;charset=UTF-8'

axios.interceptors.request.use(config => {
  config.headers.Origin1 = 'http://121.196.166.141:8282'
  // config.headers.Origin1 = 'http://localhost:8282'
  if (sessionStorage.getItem('token')!=null){
    config.headers.Authorization = sessionStorage.getItem('token')
  }
  else{
    config.headers.Authorization = localStorage.getItem('token')
  }
  // console.log(config)
  // 必须在最后返回config
  return config
},error => {
  return Promise.reject(error)
})
// axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'
Vue.config.productionTip = false


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
